import React from 'react';
const Content = () => {
    const [obj, setobj] = React.useState({ name: "张三", age: 18 })
    const [a, seta] = React.useState([{ name: "张三", age: 18 }, { name: "李四", age: 19 }])
    const fn2 = () => {
        setobj({ ...obj, age: obj.age = 20 })
    }
    const fn3 = () => {
        seta([...a,a[0].name='王五'])
    }
    return (
        <div>
            <h1>Content</h1>
            <h2>{obj.age}</h2>
            <h2>{a[0].name}</h2>
            <button onClick={fn2}>点击修改obj复杂数据</button>
            <button onClick={fn3}>点击修改a数组复杂数据</button>
        </div>
    )
}
export default Content;